
import React, { lazy } from 'react';
import Recommend from '@/pages/discover/subPages/recommend'
import Discover from '@/pages/discover';

import { Redirect } from 'react-router';




const Ranking = lazy(() => import('../pages/discover/subPages/ranking'))
const Album = lazy(() => import('../pages/discover/subPages/album'));
const Artist = lazy(() => import('../pages/discover/subPages/artist'));
const Djradio = lazy(() => import('../pages/discover/subPages/djradio'));
const Songs = lazy(() => import('../pages/discover/subPages/songs'));
const Search = lazy(() => import('../pages/search'));
const SearchAlbum = lazy(() => import('../pages/search/subPages/album'));
const SearchSinger = lazy(() => import('../pages/search/subPages/singer'));
const SearchSingle = lazy(() => import('../pages/search/subPages/single'));

const SongsListDetail = lazy(() => import('../pages/songListDetail'));
const Song = lazy(() => import('../pages/song'));
const Friend = lazy(() => import('../pages/friend'));
const Mine = lazy(() => import('../pages/mine'));
const Profile = lazy(() => import('../pages/profile'))
const NotFound = lazy(() => import('../pages/404'));


const routes = [
    {
        path: '/',
        exact: true,
        render: () => <Redirect to='/discover' />
    }, {
        path: '/discover',
        component: Discover,
        routes: [
            {
                path: '/discover',
                exact: true,
                render: () => <Redirect to='/discover/recommend' />
            }, {
                path: '/discover/recommend',
                component: Recommend
            },
            {
                path: '/discover/album',
                component: Album
            },
            {
                path: '/discover/songs',
                component: Songs
            },
            {
                path: '/discover/artist',
                component: Artist
            },
            {
                path: '/discover/djradio',
                component: Djradio
            },

            {
                path: '*',
                component: NotFound
            }
        ]
    }, {
        path: '/search',
        component: Search,
        routes: [
            {
                path: '/search',
                exact: true,
                render: () => <Redirect to='/search/single' />
            }, {
                path: '/search/single',
                component: SearchSingle
            }, {
                path: '/search/singer',
                component: SearchSinger
            }, {
                path: '/search/album',
                component: SearchAlbum
            }, {
                path: '*',
                component: NotFound
            }
        ]
    },
    {
        path: '/songlist',
        component: SongsListDetail
    },
    {
        path: '/song',
        component: Song
    },

    {
        path: '/mine',
        component: Mine
    }, {
        path: '/friend',
        component: Friend
    }
    , {
        path: '*',
        component: NotFound
    }

]
export default routes